/**
 * Created by Administrator on 2018/10/28.
 */
import React from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import * as userinfoActions from '../actions/userinfo'

import A from '../components/A'
import B from '../components/B'
import C from '../components/C'
class Hello extends React.Component {
  componentDidMount() {
    this.props.userinfoActions.login({
      userid: 'abc',
      city:'xian'
    })
  }
  render() {
    return (<div>
      <p>hello world</p>
      <hr/>
      <A userinfo={this.props.userinfo}/>
      <hr/>
      <B userinfo={this.props.userinfo}/>
      <hr/>
      <C />
    </div>)
  }
}

function mapStateToProps(state){
  return {
    userinfo: state.userinfo
  }
}

function mapDispatchToProps(dispatch) {
  return {
    userinfoActions: bindActionCreators(userinfoActions,dispatch)
  }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Hello)